package cn.liujinnan.tetris.ui;
/*
 * Copyright(c) 2021 by liujinnan.cn All rights Reserved.
 */

import cn.liujinnan.tetris.cache.TetrisPropertiesCache;
import cn.liujinnan.tetris.constant.LanguagePropertiesKeyEnum;
import cn.liujinnan.tetris.service.ReloadService;
import cn.liujinnan.tetris.ui.menu.GameMenu;

import javax.swing.*;

/**
 * 游戏主窗口
 * @author LiuJinan
 * @date 2021-08-21 16:27
 */
public class GameMainUi extends JFrame {


    public GameMainUi() {
        // 启动时加载所有配置文件到map
        TetrisPropertiesCache propertiesCache = TetrisPropertiesCache.getInstance();

        String tetrisTitle = propertiesCache.getValue(LanguagePropertiesKeyEnum.TETRIS_TITLE.getKey());
        this.setTitle(tetrisTitle);
        this.setVisible(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        // 设置窗口大小
        ReloadService reloadService = new ReloadService();
        reloadService.reloadWindowSize(this);

        // 菜单栏
        GameMenu gameMenu = new GameMenu();
        this.setJMenuBar(gameMenu);
    }
}
